/*******************************************************************************
 * Copyright (c) 2011 EclipseDevX.org and others.
 * 
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at:
 * 
 *     http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package org.eclipsedevx.core.preferences;

import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipsedevx.core.DevXCorePlugin;
import org.osgi.framework.Version;

public class MainPreferencePage extends FieldEditorPreferencePage implements
		IWorkbenchPreferencePage {

	public MainPreferencePage() {
		super(GRID);

		setDescription("EclipseDevX v" + getVersionText() + " - Eclipse development productivity tools");
		
		setPreferenceStore(DevXCorePlugin.getPlugin().getPreferenceStore());
		noDefaultAndApplyButton();
	}

	/**
	 * Creates the field editors. Field editors are abstractions of the common
	 * GUI blocks needed to manipulate various types of preferences. Each field
	 * editor knows how to save and restore itself.
	 */
	public void createFieldEditors() {
//		addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
//				"&Directory preference:", getFieldEditorParent()));
//		addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN,
//				"&An example of a boolean preference", getFieldEditorParent()));
//
//		addField(new RadioGroupFieldEditor(PreferenceConstants.P_CHOICE,
//				"An example of a multiple-choice preference", 1,
//				new String[][] { { "&Choice 1", "choice1" },
//						{ "C&hoice 2", "choice2" } }, getFieldEditorParent()));
//		addField(new StringFieldEditor(PreferenceConstants.P_STRING,
//				"A &text preference:", getFieldEditorParent()));
	}

	public void init(IWorkbench workbench) {

	}

	private static String getVersionText() {
		Version version = DevXCorePlugin.getPlugin().getBundle().getVersion();
		
		return version.getMajor() + "." + version.getMinor() + "." + version.getMicro();
	}

}
